package xiangmu.schoolpaper.controller.system;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import xiangmu.schoolpaper.pojo.DTO.UpdateSystemWeightDTO;
import xiangmu.schoolpaper.result.Result;
import xiangmu.schoolpaper.service.system.UpdateSystemWeightService;

@Slf4j
@RestController
@Tag(name="修改模板权重信息")
public class UpdateSystemWeightController {
@Autowired
    private UpdateSystemWeightService updateSystemWeightService;

    @PostMapping("/system/update/weight")
    @Operation(summary = "修改模板权重信息")
    public Result updateSystemWeight(@RequestBody UpdateSystemWeightDTO updateSystemWeightDTO) {
        try {
            updateSystemWeightService.updateSystemWeight(updateSystemWeightDTO);
            return Result.success("权重修改成功");
        } catch (Exception e) {
            log.error("权重修改失败", e);
            return Result.error("权重修改失败：" + e.getMessage());
        }
    }



}
